import React from 'react';
import LmoNrcStore from './lmonrcStore';
import BacklogListPage from './backlogListPage';
import NrcSubmitPage from './nrcSubmitPage';
import NrcAuditPage from './nrcAuditPage';

function NrcBacklogHome({ navigation }) {
  const lmonrcStore = LmoNrcStore.useStore();
  const handleNrcView = (navkind, item) => {
    if (navkind === 'edit') {
      navigation.navigate(NrcSubmitPage.routeName, item);
    } else if (navkind === 'audit') {
      navigation.navigate(NrcAuditPage.routeName, item);
    }
  };
  return (
    <BacklogListPage
      getBacklogs={lmonrcStore.getNrcBacklogs}
      backlogList={lmonrcStore.nrcBacklogs}
      onBackLogView={handleNrcView}
    />
  );
}

NrcBacklogHome.routeName = 'NrcBacklogHome';
NrcBacklogHome.permission = 'RNrcBacklog';
export default NrcBacklogHome;
